package hflyeer.gitee.com.service.impl;

import hflyeer.gitee.com.dao.EmployeeDao;
import hflyeer.gitee.com.entity.Employee;
import hflyeer.gitee.com.service.SelfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("selfService")
public class SelfServiceImpl implements SelfService {

    @Autowired
    private EmployeeDao dao;

    /**
     * 登入
     * @param sn
     * @return
     */
    public Employee login(String sn,String password) {
        Employee employee = dao.get(sn);
        if (employee!=null&&employee.getPassword().equals(password)){
            return employee;
        }
        return null;
    }

    /**
     * 修改密码
     * @param employee
     */
    public void changePassword(Employee employee) {
        dao.update(employee);
    }

}
